import { City } from '../../City';
import { Job } from '../modules/Job';
import { Building } from '../Building';
import { Zone } from './Zone';

/**
 * 工业区
 */
export class IndustrialZone extends Zone {

    job = new Job(this);

    constructor() {
        super();
        this.name = generateBusinessName();
        this.type = Building.type.industrial;
    }

    simulate(city: City) {
        super.simulate(city);
        this.job.simulate();
    }

    dispose() {
        this.job.dispose();
        super.dispose();
    }

    toHTML() {
        let html = super.toHTML();
        html += this.job.toHTML();
        return html;
    }
}

// Arrays of words for generating business names
const prefixes = ['瑞昌市', '南京市', '九江市', '北京市', '上海市', '苏州市', '深圳市', '广州市', '杭州市'];
const suffixes = ['滴滴', '百度', '字节', '抖音', '阿里', '华为', '小米', '特斯拉', '希音'];
const businessSuffixes = ['纺织工厂', '玩具工厂', '股票公司', '科技公司', '有限公司'];

// Function to generate a random industrial business name
function generateBusinessName() {
    const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];
    const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
    const businessSuffix = businessSuffixes[Math.floor(Math.random() * businessSuffixes.length)];

    return prefix + ' ' + suffix + ' ' + businessSuffix;
}